package com.example.myapplication.apter;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.example.myapplication.R;
import com.example.myapplication.ShuJu.MyappealBean;
import com.example.myapplication.ShuJu.OrdinaryregistrationBean;
import com.example.myapplication.government.ClaimDdetailsActivity;

import java.util.List;

public class OrdinaryregistrationApter extends  RecyclerView.Adapter<OrdinaryregistrationApter.MyHolder>{
    private Context context ;
    private List<OrdinaryregistrationBean.RowsBean> list;
    private View view;


    public OrdinaryregistrationApter(Context context, List<OrdinaryregistrationBean.RowsBean> list) {
        this.context = context;
        this.list = list;

    }

    @NonNull
    @Override
    public OrdinaryregistrationApter.MyHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        //填充试图
        view = LayoutInflater.from(context).inflate(R.layout.item_ordinaryregistration,null);
        return new OrdinaryregistrationApter.MyHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull OrdinaryregistrationApter.MyHolder holder, int position) {
        holder.date_Ordinaryregistration.setText("预约时间: " + list.get(position).getReserveTime());

        if(list.get(position).getType().equals("2")){
            holder.type_Ordinaryregistration.setText("门诊类型:  普通号");
        }else if(list.get(position).getType().equals("1")){
            holder.type_Ordinaryregistration.setText("门诊类型:  专家号");
        }

        holder.title_Ordinaryregistration.setText("预约人： "+list.get(position).getPatientName());
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    class MyHolder extends RecyclerView.ViewHolder {

        TextView title_Ordinaryregistration;
        TextView type_Ordinaryregistration;
        TextView date_Ordinaryregistration;
        public MyHolder(@NonNull View itemView) {
            super(itemView);
            title_Ordinaryregistration = itemView.findViewById(R.id.title_Ordinaryregistration);
            type_Ordinaryregistration = itemView.findViewById(R.id.type_Ordinaryregistration);
            date_Ordinaryregistration = itemView.findViewById(R.id.date_Ordinaryregistration);
        }
    }
}

